@alipay/faas-db-builder
db 调用参数解析器
用法示例
import { MongoBuilder } from '@alipay/faas-db-builder';
const db = new MongoBuilder();
const res1 = db.listCollection(123, 456);
assert.deepStrictEqual(res, {
action: 'queryList',
options: {
$limit: 123,
$skip: 456,
},
target: 'collection',
});
const res2 = db.collection('todo').add({
data: {
text: 'hello mongo',
done: false,
},
});
assert.deepStrictEqual(res2, {
action: 'create',
collectionName: 'todo',
options: {
done: false,
text: 'hello mongo',
},
target: 'document',
});